﻿@using KRM.Core
@model WebPermissionMenuLink
@{
    Layout = null;
    List<KRM.Core.WebPermissionDepartment> lstDepartments = ViewBag.Department;
}

<input type="hidden" name="ID" value="@Model.ID"/>
@Html.Partial("Partial/_MessageResult")
<div class="row-fluid">
<div class="span5" style="margin-top: 20px;">
    <div class="row-fluid">
        <div class="span3">Expando</div>
        <div class="span8">
            @Html.DropDownList("ExpandoID")
        </div>
    </div>
    <div class="row-fluid">
        <div class="span3">Link text</div>
        <div class="span8">
            <input type="text" class="input-block-level" name="name" required="required" value="@Model.Name" />
        </div>
    </div>
    <div class="row-fluid">
        <div class="span3">Link</div>
        <div class="span8">
            <input type="text" class="input-block-level" name="Link" required="required" value="@Model.Link" />
        </div>
    </div>
    <div class="row-fluid">
        <div class="span3"></div>
        <div class="span8 text-right">
            <input type="submit" class="btn btn-primary" style="padding: 8px 30px;" value="Save"/>
        </div>
    </div>
</div>
<fieldset class="span4">
    <legend>Department</legend>
    <div style="height: 128px; overflow: auto">
        @foreach (var item in lstDepartments)
        {
            if (Model.WebPermissionDepartments.FirstOrDefault(a => a.ID == item.ID) != null)
            {
                <div class="control">
                    <label class="checkbox">
                        <input type="checkbox" name="Department@(item.ID)" checked="checked" value="@item.ID"/>
                        @item.Name
                    </label>
                </div>
            }
            else
            {
                <div class="control">
                    <label class="checkbox">
                        <input type="checkbox" name="Department@(item.ID)" value="@item.ID"/>
                        @item.Name
                    </label>
                </div>
            }
        }
    </div>
</fieldset>
    </div>
